<%@ page language="java" pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<html>
<head>
<script type="text/javascript">
	
</script>

<title>Admin Data Manager</title>
</head>

<body>

	<c:set var="claz" value="class" />
	<c:set var="iddf" value="id" />

	1. Insert must not full id column.
	<br /> 2. Update must remove "class " for class.

	<table border="1" style="border-color: gray;">
		<tr bgcolor="black" style="color: white;">
			<c:forEach items="${keyMap}" var="entry">
				<td><c:out value="${entry.key}" /></td>
			</c:forEach>
			<td><b>Command</b></td>
		</tr>
		
		<c:forEach items="${list}" var="map">
			<form action="/common/update" method="post">
				<tr>
					<c:forEach items="${map}" var="entry">
						<td><textarea name="<c:out value="${entry.key}"/>" cols="15"
							style="overflow: hidden;" rows="1" <c:if test="${entry.key==iddf}">
							<c:set var="thisid" value="${entry.value}" />
							readonly="readonly"</c:if>><c:out value="${entry.value}" /></textarea></td>
					</c:forEach>
					<td><input type="submit" value="Update" /> <a
						href="/common/delete?class=${pClazName}&id=${thisid}">Delete</a>
					</td>
				</tr>
			</form>
		</c:forEach>
		
		<!-- form add -->
		<form action="/common/insert" method="post">
		<tr>
			<c:forEach items="${keyMap}" var="entry">
				<td>
				<textarea name="<c:out value="${entry.key}"/>" cols="15"
						style="overflow: hidden;" rows="1"
						<c:if test="${entry.key==claz}">readonly="readonly"</c:if>><c:if test="${entry.key==claz}"><c:out value="${pClazName}" /></c:if></textarea></td>
			</c:forEach>
			<td><input type="submit" value="Insert" /></td>
		</tr>
		</form>
		
	</table>

	<hr />
	
	<textarea name="testText" cols="120" style="overflow: scroll;" rows="12"></textarea>

</body>
</html>